(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/resources/Script/Ssg/API/QQ/QQSound.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, '35e61RRAtZLdJgw/w310BxW', 'QQSound', __filename);
// Script/Ssg/API/QQ/QQSound.js

"use strict";

var effectPool = null,
    musicPool = {};

var QQSound = cc.Class({

    statics: {

        /**
         * 播放音效
         * @param fileName
         */
        playEffect: function playEffect(fileName) {
            if (!this.effectPool) {
                this.effectPool = BK.createAudioContext({ "type": "effect" });
            }
            this.effectPool.src = 'GameRes://res/raw-assets/resources/Sound/' + fileName;
            this.effectPool.play();
        },

        /**
         * 播放音乐
         * @param fileName
         * @param isLoop
         */
        playMusic: function playMusic(fileName, isLoop) {
            if (!this.musicPool[fileName]) {
                this.musicPool[fileName] = BK.createAudioContext();
                this.musicPool[fileName].loop = isLoop;
                this.musicPool[fileName].src = 'GameRes://res/raw-assets/resources/Sound/' + fileName;
            }
            this.musicPool[fileName].play();
        },

        stopMusic: function stopMusic(fileName) {
            if (fileName) {
                this.musicPool[fileName].stop();
                this.musicPool[fileName].destroy();
                this.musicPool[fileName] = null;
                return;
            }
            for (var p in this.musicPool) {
                this.musicPool[p].stop();
                this.musicPool[p].destroy();
                this.musicPool[p] = null;
            }
        },

        /**
         * 暂停音乐
         * @param fileName
         */
        pauseMusic: function pauseMusic(fileName) {
            if (fileName) {
                this.musicPool[fileName].pause();
                return;
            }
            for (var p in this.musicPool) {
                this.musicPool[p].pause();
            }
        },

        /**
         * 恢复音乐播放
         * @param fileName
         */
        resumeMusic: function resumeMusic(fileName) {
            if (fileName) {
                this.musicPool[fileName].play();
                return;
            }
            for (var p in this.musicPool) {
                this.musicPool[p].play();
            }
        }

    }
});

module.exports = QQSound;

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=QQSound.js.map
        